package com.baizhi.cmfz.service.impl;

import com.baizhi.cmfz.dao.LogDao;
import com.baizhi.cmfz.entity.Log;
import com.baizhi.cmfz.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogDao logDao;
    @Override
    public Map showPageLog(int page, int limit, String type) {
       if(type==null){
           type=null;
       }else {
           type="%"+type+"%";
       }
        int offset=(page-1)*limit;
        List<Log> list=logDao.showPageLog(offset,limit,type);
        int count=logDao.showCount(type);
        Map map=new HashMap();
            map.put("data",list);
            map.put("count",count);
            map.put("code",0);
            map.put("msg","");
        return map;
    }
}
